package com.ruoyi.shop.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 作者: @author Alan Zhang
 * 时间: 2021/10/27 20:17
 * 描述:
 */
public class ShopCouponVo {
    /** 优惠券id */
    private Long id;

    /** 优惠券名称 */
    private String title;

    /** 图片 */
    private String icon;

    /** 类型 1满减券  2叠加满减券  3无门槛券 */
    private Integer type;

    /** 满多少金额 */
    private BigDecimal withAmount;

    /** 优惠券金额 */
    private BigDecimal amount;

    /** 发放开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date startTime;

    /** 发放结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endTime;

    /** 时效:1绝对时效（XXX-XXX时间段有效）  2相对时效（领取后N天有效） */
    private Integer validType;

    /** 使用开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date validStartTime;

    /** 使用结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date validEndTime;

    /** 自领取之日起有效天数 */
    private Integer validDays;

    /** 领取券id */
    private Long codeId;

    /** 状态 0未领取  1已领取  */
    private Integer receiveStatus;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public BigDecimal getWithAmount() {
        return withAmount;
    }

    public void setWithAmount(BigDecimal withAmount) {
        this.withAmount = withAmount;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Integer getValidType() {
        return validType;
    }

    public void setValidType(Integer validType) {
        this.validType = validType;
    }

    public Date getValidStartTime() {
        return validStartTime;
    }

    public void setValidStartTime(Date validStartTime) {
        this.validStartTime = validStartTime;
    }

    public Date getValidEndTime() {
        return validEndTime;
    }

    public void setValidEndTime(Date validEndTime) {
        this.validEndTime = validEndTime;
    }

    public Integer getValidDays() {
        return validDays;
    }

    public void setValidDays(Integer validDays) {
        this.validDays = validDays;
    }

    public Long getCodeId() {
        return codeId;
    }

    public void setCodeId(Long codeId) {
        this.codeId = codeId;

        if(codeId == null){
            setReceiveStatus(0);
        } else {
            setReceiveStatus(1);
        }
    }

    public Integer getReceiveStatus() {
        return receiveStatus;
    }

    public void setReceiveStatus(Integer receiveStatus) {
        this.receiveStatus = receiveStatus;
    }
}
